package com.kins.so.somanage.entity;

import lombok.Data;
import org.springframework.scheduling.support.SimpleTriggerContext;

import java.text.DecimalFormat;

/**
 * @Description:
 * @Author: 申科
 * @Date:2025/11/11 17:52
 */
@Data
public class SoManage  extends RuleBaseEntity{
    private String apiName;

    private String apiNameCn;

    private String status;

    private String version;

    private String activeVersion;

    /**
     * 是否启用0，1
     */
    private String enabled;

    private String targetType;

    private String signAlgorithm;

    private String mockFlag;

    private String apiDesc;

    private String restoreVersion;

    private String typeId;

    private String typeName;

    /**
     * 访问路径
     */

    private String path;

    private String method;

    private String domain;

    private String interfaceType;
    private String editMode;

    private String haveReportNode;

    private String publicKnowledgeType;

    private String privateKnowledgeType;

    /**
     * 部署的服务器
     */
    private SoEnvironmentManageEntity[] publishServices;

    /**
     * 保存演示出来的信息
     */
    private List<ServiceInterfaceParamInfo> inputParams;

    /**
     * 出餐
     *
     */
    private List<ServiceInterfaceParamInfo> outputParam;

    public void initVersion(){
        DecimalFormat decimalFormat = new DecimalFormat("0.00");
        String verStr = this.getVersion().substring(1);
        if(verStr !=null){
            int idx = verStr.indexOf("-tmp");
            if(idx > 0){
                verStr = verStr.substring(0,idx);
            }
        }
        float version = Float.parseFloat(verStr);
        version +=1;
        this.setVersion("v"+decimalFormat.format(version));
        if("1".equals(this.getStatus())){
            this.setStatus("1");
        }
        this.setDelFlag("0");
    }

}
